package com.learn2.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author:Mark
 * @Description:
 * @Date: Created on 14:30 2018-11-15
 * @Modify by:
 */
@Controller
@RequestMapping("/anno")
public class DemoAnnoController {
  @RequestMapping(produces = "text/plain;charset=UTF-8")
  public @ResponseBody String index(HttpServletRequest request){
    System.out.println("================");
    return "url:"+request.getRequestURL()+"可以访问";
  }

  @RequestMapping(value = "/pathvar/{str}",produces = "text/plain;charset=utf-8")
  public @ResponseBody String demoPathVar(@PathVariable String str ,HttpServletRequest request){
    return "url:"+request.getRequestURL()+"能够访问...str==="+str;
  }

  @RequestMapping(value = "/requestParam", produces = "text/plain;charset=utf-8")
  public  @ResponseBody String passRequestParam(Long id, HttpServletRequest request){
    return "url:"+request.getRequestURL()+"com on id="+id;
  }

}
